package com.yupi.yuaicodemother.core.parser;

import com.yupi.yuaicodemother.exception.BusinessException;
import com.yupi.yuaicodemother.exception.ErrorCode;
import com.yupi.yuaicodemother.model.enums.CodeGenTypeEnum;

/**
 * @Author: LZY
 * @CreateTime: 2025-10-07
 * @Description:
 * @Version: 1.0
 */

public class CodeParserExecutor {


    private static final HtmlCodeParser htmlCOdeParser = new HtmlCodeParser();
    private static final MultiFileCodeParser multiFileCodeParser = new MultiFileCodeParser();




    public static Object executorParser(String condeContent, CodeGenTypeEnum codeGenTypeEnum){


        return switch (codeGenTypeEnum) {

            case HTML -> htmlCOdeParser.parseCode(condeContent);

            case MULTI_FILE -> multiFileCodeParser.parseCode(condeContent);

            default -> throw new BusinessException(ErrorCode.SYSTEM_ERROR,"不支持的代码生成类型："+ codeGenTypeEnum);
        };

        }



}
